﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using GMLogging;

namespace ThouShaltNotBrick.Logic.GeneralObjects
{
    public sealed class BrickType
    {
        #region Properties
        #region Name
        /// <summary>
        /// Name property.
        /// </summary>
        public string Name { get; private set; }
        #endregion

        private List<BrickState> mBrickStates;
        #endregion

        #region Constructors
        public BrickType(
            string pName,
            List<BrickState> pBrickStates)
        {
            if (pBrickStates == null)
            {
                Exception e = new ArgumentNullException("pBrickStates");
                Logger.Error(e.Message);
                throw e;
            }

            Name = pName;
            mBrickStates = pBrickStates;
        }
        #endregion

        #region Methods
        public List<BrickState> GetAllBrickStates()
        {
            return new List<BrickState>(mBrickStates);
        }

        public BrickState GetBrickStateByIndex(int pIndex)
        {
            if (0 <= pIndex && pIndex < mBrickStates.Count)
            {
                return mBrickStates[pIndex];
            }
            else
            {
                return null;
            }
        }
        #endregion
    }
}